package com.wyg.epdata.util;

import com.wyg.epcommonbase.common.enums.SdfEnum;
import lombok.Data;

import java.text.SimpleDateFormat;

/**
 * @Author: WangYongGan
 * @Date: 2022/3/30 12:11
 * @Description:
 */
@Data
public class DateUtil {
    public static int a;
    public static ThreadLocal<SimpleDateFormat> sdfPool = new ThreadLocal<>();

    public static SimpleDateFormat getSDF(SdfEnum se) {
        final SimpleDateFormat simpleDateFormat = sdfPool.get();
        if (simpleDateFormat == null) {
            SimpleDateFormat sdf = new SimpleDateFormat(se.getPattern());
            sdfPool.set(sdf);
        }
        return sdfPool.get();
    }
}
